<template>
	<el-form-item :label="title" class="page-search-date">
		<el-date-picker
			v-model="timeData"
			class="!w-[240px]"
			type="daterange"
			value-format="yyyy-MM-dd 00:00:00"
			range-separator="至"
			start-placeholder="开始日期"
			end-placeholder="结束日期"
			@change="handleGetTime"
		>
		</el-date-picker>
	</el-form-item>
</template>

<script>
export default {
	name: 'Index',
	props: {
		title: {
			type: String,
			default: '',
		},
		getTime: {
			type: Function,
			default: () => ({}),
		},
	},
	data() {
		return {
			timeData: [],
		};
	},
	methods: {
		handleGetTime(time) {
			this.getTime(time[0], time[1]);
		},
		resetTime() {
			this.timeData = [];
			this.getTime(null, null);
		},
	},
};
</script>

<style scoped lang="scss"></style>
